1. /* howdigs.cpp by K.Tsuru */
  2. // since ver 2.18
  3. /*****************************************
  4. SNumber sub-function
  5. It returns how many digits "x" has in radix "r" i.e.
  6. a value x which satisfies a condition x<= r^n.
  7. e.g. x = 25, r = 10 --> n = 2
  8. *****************************************/
  9. #ifndef TYPEDEF_H
  10. #include "typedef.h"
  11. #endif
  12. uint howdigsrdx(long x, long r) {
  13. if(x < r) return x ? 1 : 0;
  14. uint n = 0;
  15. while(x){
  16. x /= r; n++;
  17. }
  18. return n;
  19. }

howdigs.cpp : last modifiled at 2008/04/24 09:52:48(480 bytes)
created at 2016/04/11 11:17:20
The creation time of this html file is 2017/10/07 10:54:15 (Sat Oct 07 10:54:15 2017).